import { findHeadCategory } from '@/api/home'

// 分类模块
export default {
  namespaced: true,
  state () {
    return {
      // 分类信息集合
      list: []
    }
  },
  // 加载成功后需要修改list所以需要mutations
  mutations: {
    setList (state, CategoryList) {
      state.list = CategoryList
    }
  },
  actions: {
    getList (context) {
      findHeadCategory().then(data => {
        console.log(data)
        context.commit('setList', data.result)
      })
    }
  }

}
